package com.nl.lib_project.view.util

import android.graphics.Outline
import android.graphics.Rect
import android.view.View
import android.view.ViewOutlineProvider

/**
 * 作者: wangfei 创建时间: 2021/11/22 包名: com.nl.lib_project.view.util 类名: TextureVideoViewOutlineProvider
 */
open class TextureViewOProvider(var mRadius: Float, var mLeftMargin: Int, var mTopMargin: Int) :
    ViewOutlineProvider() {

  override fun getOutline(view: View?, outline: Outline?) {
    val rect = Rect()
    view?.getGlobalVisibleRect(rect)
    val selfRect =
        Rect(
            mLeftMargin,
            mTopMargin,
            rect.right - rect.left - mLeftMargin,
            rect.bottom - rect.top - mTopMargin)
    outline?.setRoundRect(selfRect, mRadius)
  }
}
